SharePoint 2013 REST API  syntax

I have a piece of code that is used to fetch list items from host web

function getItems() {
    executor = new SP.RequestExecutor(appweburl);
    executor.executeAsync(
        {
            url:
                appweburl +
            "/_api/SP.AppContextSite(@target)/web/lists/getbyTitle('Products')/Items?$select=Title&@target='" + hostweburl + "'",
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: onSuccess,
            error: onFail
        }
    );
}

However the following assignment to url property of SP.RequestExecutor is confusing

/_api/SP.AppContextSite(@target)/web/lists/getbyTitle('Products')/Items?$select=Title&@target='" + hostweburl + "'"

Is SP.AppContextSite(@target) an embedded function call inside the url to which the parameter @target is defined in the URL itself?

Is this syntax of making function calls in URL and passing parameters using @ symbol something peculiar to SharePoint REST API or of jQuery?





July 29th, 2013 5:21am

>Is SP.AppContextSite(@target) an embedded function call inside the url to which the parameter @target is defined in the URL itself? 

Yes

>Is this syntax of making function calls in URL and passing parameters using @ symbol something peculiar to SharePoint REST API or of jQuery?

We use it in REST.

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2013 5:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics